package com.heima.apis.config;

import com.heima.utils.thread.AdminThreadLocalUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;

/**
 * @author 黄晏凯
 */
@Slf4j
public class MyFeignInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate template) {
        log.info("===request: {}", template.url());
        Integer id = AdminThreadLocalUtil.getUser().getId();
        log.info("id: {}", id);
        String idStr = id.toString();
        template.header("userId", idStr);
    }
}